package com.chezai.client.server.util;

import com.jx.driving.request.domain.LocationAttachement;

import java.util.ArrayList;
import java.util.List;

/**
 * Describe 汽车其它参数
 * Created by LZF on 2016/9/20.
 */
public class DeviceParameterUtil {

    public List<LocationAttachement> buildLocationAttachement(long mileage , int fuel , int altitude , int rpm) {
        List<LocationAttachement> locationAttachements = new ArrayList<>(4);
        //0x01,500
        //里程
        if (mileage != -1) {
            LocationAttachement carMileage = new LocationAttachement();
            carMileage.setId((short) 0x01);
            carMileage.setLong(mileage);
            locationAttachements.add(carMileage);
        }
        if (fuel != -1) {
            LocationAttachement youliang = new LocationAttachement();
            youliang.setId((short) 0x02);
            youliang.setInt(fuel);
            locationAttachements.add(youliang);
        }
        if (altitude != -1) {
            LocationAttachement haiba = new LocationAttachement();
            haiba.setId((short) 0x03);
            haiba.setInt(altitude);
            locationAttachements.add(haiba);
        }
        if (rpm != -1) {
            LocationAttachement engine_rpm = new LocationAttachement();
            engine_rpm.setId((short) 0x05);
            engine_rpm.setInt(rpm);
            locationAttachements.add(engine_rpm);
        }
        return locationAttachements;

    }
}
